<?php
//------- logistic wxapp -------
namespace app\admin\validate;

use think\Validate;

class UserValidate extends Validate {
    protected $rule = [
        'user_login' => 'require|unique:user,user_login',
        'user_pass'  => 'require',
        'mobile'     => 'require|mobile|unique:user,mobile',
        'user_email' => 'email|unique:user,user_email',
    ];
    protected $message = [
        'user_login.require' => '用户不能为空',
        'user_login.unique'  => '用户名已存在',
        'user_pass.require'  => '密码不能为空',
        'mobile.require'     => '手机不能为空',
        'mobile.mobile'      => '手机格式不正确',
        'mobile.unique'      => '该手机已经存在',
        'user_email.email'   => '邮箱不正确',
        'user_email.unique'  => '邮箱已经存在',
    ];

    protected $scene = [
        'add'  => ['user_login', 'user_pass', 'mobile', 'user_email'],
        'edit' => ['user_login', 'mobile',  'user_email'],
    ];
}